﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Gakita.View.Menu
{
    /* This class handles the logic for the main menu, the options menu and the select level menu. There are no objects of this class. */
    class MenuModel
    {
        public enum MenuOptions
        {
            NewGame = 1,
            SelectLevel = 2,
            BestTimes = 3,
            Options = 4,
            ExitGame = 5,
            FullScreen = 6,
            JumpKey = 7,
            LeftKey = 8,
            RightKey = 9,
            FirstLevel = 10,
            SecondLevel = 11,
            ThirdLevel = 12,
            FourthLevel = 13,
            Nothing = 14,
        };

        protected MenuOptions _selectedMenuOption;
        protected MenuOptions[] _menuOptions;
        protected int _minMenuOption;
        protected int _maxMenuOption;

        public virtual void SelectPreviousMenuOption()
        {
            if ((int)_selectedMenuOption <= _minMenuOption)
            {
                _selectedMenuOption = (MenuModel.MenuOptions)_maxMenuOption;
            }
            else
            {
                _selectedMenuOption = _selectedMenuOption - 1;
            }
        }

        public virtual void SelectNextMenuOption()
        {
            if ((int)_selectedMenuOption >= _maxMenuOption)
            {
                _selectedMenuOption = (MenuModel.MenuOptions)_minMenuOption;
            }
            else
            {
                _selectedMenuOption = _selectedMenuOption + 1;
            }
        }

        public MenuOptions GetSelectedMenuOption()
        {
            return _selectedMenuOption;
        }

        public MenuOptions[] GetMenuOptions()
        {
            return _menuOptions;
        }
    }
}
